<template>
  <div id="brand">
    <div class="nav">
      <van-nav-bar
        :title="brandInfo.data.name"
        left-text="返回"
        left-arrow
        @click-left="onClickLeft"
      />
    </div>
    <div class="brand-cont">
      <div class="head-img">
        <img :src="brandInfo.data.app_list_pic_url" />
        <p>{{brandInfo.data.name}}</p>
      </div>

      <div class="head-desc">
        <div class="van-multi-ellipsis--l3">{{brandInfo.data.simple_desc}}</div>
      </div>

      <ul class="tab-list">
        <li class="tab-item" v-for="item in brandInfo.goodsList" :key="item.id">
          <img :src="item.list_pic_url" />
          <p class="item-title">{{item.name}}</p>
          <p class="item-price">￥ {{item.retail_price}}</p>
        </li>
      </ul>

      <div class="more" v-if="isShow">数据暂无...</div>
    </div>
  </div>
</template>

<script>
import { detailaction } from "@/api/home/brandlist/brand";
export default {
  data() {
    return {
      brandInfo: "",
      isShow: false,
    };
  },
  created() {
    detailaction({ id: this.$route.query.id }).then((res) => {
      this.brandInfo = res;
      if (res.goodsList.length == 0) {
        this.isShow = true;
      }
    });
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss" scoped>
#brand {
  background-color: rgb(244, 244, 244);
}
.brand-cont {
  height: calc(100% -36px);
  overflow: auto;
}
.nav {
  position: fixed;
  width: 375px;
  top: 0;
  left: 0;
  z-index: 99;
}
.head-img {
  position: relative;
  width: 375px;
  margin-top: 38px;
  img {
    width: 375px;
    height: 144px;
  }
  p {
    position: absolute;
    display: block;
    height: 25px;
    border-bottom: 1px solid #fff;
    line-height: 20px;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-100%);
    font-size: 20px;
    text-align: center;
    color: #fff;
    z-index: 9;
  }
}
.head-desc {
  width: 375px;
  height: 100px;
  padding: 20px;
  box-sizing: border-box;
  font-size: 15px;
  text-align: center;
  color: rgb(102, 102, 102);
  background-color: #fff;
}
.tab-list {
  width: 375px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 8px;
  .tab-item {
    width: 185px;
    padding: 10px 17px 0;
    margin-bottom: 4px;
    box-sizing: border-box;
    background-color: #fff;
    img {
      width: 151px;
      height: 151px;
      margin-bottom: 8px;
    }
    .item-title {
      width: 151px;
      margin-bottom: 16px;
      text-align: center;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .item-price {
      width: 151px;
      margin-bottom: 18px;
      font-size: 15px;
      color: rgb(180, 40, 45);
      text-align: center;
    }
  }
}

.more {
  width: 375px;
  margin-top: 100px;
  text-align: center;
  font-size: 15px;
}
</style>